package com.szewec.ps.util;

import android.text.TextUtils;

import com.szewec.ps.model.project.SelectUserModel;

import java.util.ArrayList;
import java.util.List;

public class StringUtils {

    public static boolean isEmpty(String string){
        return string == null || string.length() == 0;
    }

    public static boolean isNotEmpty(String string){
        return !isEmpty(string);
    }


    //拼接数组元素里面某个属性的字符串
    static public <T> String getStrWithList(String delimiter, List<T> list, IGetStrByObj<T> iGetStrByObj){
        if (list == null){
            return "";
        }
        List<String> nameList = new ArrayList<>();
        for(T t : list){
            nameList.add(iGetStrByObj.work(t));
        }
        return TextUtils.join(delimiter, nameList);
    }

    public interface IGetStrByObj<T>{
        String work(T t);
    }
}
